<!DOCTYPE html>
<html>
<head>
	<#include "/pages/templet/head.html"/>
	<script type="text/javascript" src="/assets/js/jquery.hotkeys.min.js"></script> 				<!--页面按键事件-->
	<script type="text/javascript" src="/assets/js/R3_BigData.action.js"></script> 				<!--页面按键事件-->
	<script src="/assets/js/charts/highcharts.js"></script>
	<script src="/assets/js/charts/highcharts-3d.js"></script>
	<script src="/assets/js/charts/highcharts-more.js"></script>
	<script src="/assets/js/charts/modules/exporting.js"></script>
	<script src="/assets/js/charts/modules/funnel.js"></script>
	<script src="/assets/js/R3_BigData.charts.js"></script>
	<script src="/assets/js/echarts/echarts-plain.js"></script>
	<script src="/assets/js/echarts/echarts-plain-map.js"></script>	

	<script>
		var currentParityline = "%";
	    var selColDataID  = "";		//选中列的 ID
	    var curNode ;

		var targetId = "";
		function zTreeOnDrop(event, treeId, treeNodes, targetNode, moveType) {
			var node = treeNodes[0];
			if(!node.isParent){
				if(targetId=="filter_div"){
					$("#filteradd_id").attr("href","/${orgi}/design/query/${report.id!''}/<#if reportModel??>${reportModel.id!''}</#if>/filteradd/"+encodeURIComponent(node.name)+"/"+node.lid+".html");
					$("#filteradd_id").click();
				}else if(targetId=="measure_div"){
					//alert("添加指标");
				}
			}
		};

		var cubeNodeSetting = {
			edit: {
				enable: true,
				showRemoveBtn: false,
				showRenameBtn: false,
				drag: {
					prev: DargTree.prevTree,
					next: DargTree.nextTree,
					inner: DargTree.innerTree
				}
			},
			data: {
				keep: {
							parent: true,
							leaf: true
						},
				simpleData: {
					enable: true
				}
			},
			callback: {
				onDrop: DargTree.dropTree2Dom,
				onDragMove: DargTree.dragMove,
				onMouseUp: DargTree.dom2Tree,
				onRightClick: onRightClick,
				onClick: zTreeOnClick,
				//onCollapse: alert("up"),
				onExpand: function(){
					if (treeNiceScroll) {
						treeNiceScroll.resize();
					}
				}
			},
			view: {
				showLine: false,
				nameIsHTML: true,
				showIcon: showIconForTree
			}
		};
		
		/**
		* shift 键选中事件
		*/
		var temp_parentId = "";
		var temp_ind_measure = "";
		function zTreeOnClick(event, treeId, treeNode) {
			var parentId = temp_parentId;
			var treeObj = $.fn.zTree.getZTreeObj(treeId);
			var index = treeObj.getNodeIndex(treeNode); //获取到当前节点的序列
			var ind_measure = temp_ind_measure; //获取到上一次选中的节点
			temp_ind_measure=index.toString();  //将本次的获取的节点存入隐藏域中
			temp_parentId=treeNode.parentTId;
			if(event.shiftKey){
				
				if(ind_measure != null && ind_measure != undefined && ind_measure != ""){
					var pnodes =  treeNode.getParentNode();
					
					if(parentId == null || parentId =="" || parentId == undefined){
						var node = treeObj.getNodeByTId(pnodes.tId); 
						treeObj.cancelSelectedNode(node);
						if((index <= i && i <= ind_measure) || (index >= i && i >= ind_measure)){
							treeObj.selectNode(node,true);
						}
					}else{
						var nodes = pnodes.children;
						if(nodes[0].parentTId == parentId){
							for(var j = 0 ; j < nodes.length ; j ++){
								var node = treeObj.getNodeByTId(nodes[j].tId); 
								treeObj.cancelSelectedNode(node);
								if((index <= j && j <= ind_measure) || (index >= j && j >= ind_measure)){
									treeObj.selectNode(node,true);
								}
							}
						}
					}
				}
				treeObj.selectNode(treeNode,true);
			}
		};
		
		function onRightClick(event, treeId, treeNode) {
			cubeNodeZtree.selectNode(treeNode);
			var pid = treeNode.pId;
			if(pid == null || pid == "" || pid ==undefined){
				pid = "0";
			}
			if(pid !="0" && pid != "1"){
				if (!treeNode && event.target.tagName.toLowerCase() != "button" && $(event.target).parents("a").length == 0) {
					cubeNodeZtree.cancelSelectedNode();
					showRMenu("root", event.clientX, event.clientY);
				} else if (treeNode && !treeNode.noR && treeNode.type =="dimensions") {
					cubeNodeZtree.selectNode(treeNode);
					showRMenu("node", event.clientX, event.clientY);
				} else{
					$("#rMenu_1 ul").show();
					$("#rMenu_1").css({"top":event.clientY+"px", "left":event.clientX+"px", "visibility":"visible"});
					$("body").bind("mousedown", onBodyMouseDown);
				}
			}
		}

		function showRMenu(type, x, y) {
			$("#rMenu ul").show();
			rMenu.css({"top":y+"px", "left":x+"px", "visibility":"visible"});

			$("body").bind("mousedown", onBodyMouseDown);
		}

		function hideRMenu() {
			if (rMenu) rMenu.css({"visibility": "hidden"});
			if (rMenu_1) rMenu_1.css({"visibility": "hidden"});
			$("body").unbind("mousedown", onBodyMouseDown);
		}
		function onBodyMouseDown(event){
			if (!(event.target.id == "rMenu" || $(event.target).parents("#rMenu").length>0)) {
				rMenu.css({"visibility" : "hidden"});
			}
			if (!(event.target.id == "rMenu_1" || $(event.target).parents("#rMenu_1").length>0)) {
				rMenu_1.css({"visibility" : "hidden"});
			}
		}
		function showIconForTree(treeId, treeNode) {
			return !(treeNode.type == 'measure');
		};
		function tableOperator(operator,groupid) {
			hideRMenu();
			var nodes = cubeNodeZtree.getSelectedNodes();
			if (nodes && nodes.length>0) {
				var name =  nodes[0].sname;
				var type = "measure";
				if(name=="" || name==null || name==undefined){
					name = nodes[0].name;
					type = "dimensions";
				}    
//				if($("#"+nodes[0].lid).attr("data-check")=="false"){
//					$("#"+nodes[0].lid).click();
//					$("#"+nodes[0].lid).attr("data-check","true");
//				}
				if(operator == "filter"){
					$("#filteradd_id").attr("href","/${orgi}/design/query/filteradd/${report.id!''}/<#if reportModel??>${reportModel.id!''}</#if>/"+encodeURIComponent(name)+"/"+nodes[0].lid+".html");
					$("#filteradd_id").click();
				}else if (operator == "group"){
					var lids = '';
					for(i = 0;i<nodes.length;i++){
						if(lids != ''){
								lids = lids + ',';
							}
						lids = lids + nodes[i].lid;
						}
					if(groupid != null){
						ReportAction.syncReportModelMeasure(url_list.design_url+"?name="+encodeURIComponent(nodes[0].sname)+"&type="+type+"&oid="+lids+"&pos=right&group=true&groupid="+groupid);
					}else{
						art.dialog.prompt('请输入分组名称：', function (val) {
						    ReportAction.syncReportModelMeasure(url_list.design_url+"?name="+encodeURIComponent(nodes[0].sname)+"&groupname="+encodeURIComponent(val)+"&type="+type+"&oid="+lids+"&pos=right&group=true",function(){
						    	ReportAction.loadMeasureGroup("#rMenu_group");
						    });
						}, '');
						
					}
				}else if (operator == "editGroup"){
					ReportAction.editMeasureGroup(url_list.edit_measure_group+"?groupid="+groupid);
				//	ReportAction.syncReportModelMeasure(url_list.design_url+"?type="+type+"&oid="+lids+"&pos=right&group=true&groupid="+groupid+"&cmd=edit",function(){
				    //	ReportAction.loadMeasureGroup("#rMenu_group");
				   // });
				}else if (operator == "deleteGroup"){
					ReportAction.syncReportModelMeasure(url_list.design_url+"?type="+type+"&oid="+lids+"&pos=right&group=true&groupid="+groupid+"&cmd=delete",function(){
				    	ReportAction.loadMeasureGroup("#rMenu_group");
				    });
				}else if (operator == "col"){
					ReportAction.syncReportModelMeasure(url_list.design_url+"?type="+type+"&oid="+nodes[0].lid+"&pos=right");
				}else if (operator == "row"){
					ReportAction.syncReportModelMeasure(url_list.design_url+"?type="+type+"&oid="+nodes[0].lid+"&pos=top");
				}else if (operator == "drill"){
					$("#drilldef").attr("href" , url_list.drilldef_url+"?title="+encodeURIComponent(name)+"&mid="+nodes[0].lid);
					$("#drilldef").click();
				}else if (operator == "remove"){
					if($("#"+nodes[0].lid).attr("data-check")=="true"){
						$("#"+nodes[0].lid).click();
					}
					ReportAction.syncReportModelMeasure(url_list.design_rmmeasure_url+"?type="+type+"&oid="+nodes[0].lid+"&pos=right");
				}
			} 			
		}

	
		var ReportURL = {
			newDomURL:"<#if reportModel??>/${orgi}/design/query/modelinit/${report.id!''}/${reportModel.id!""}.html</#if>",
			designReportURL:"<#if reportModel??>/${orgi}/design/query/designreport/${report.id!''}/${reportModel.id!""}.html</#if>"
			
		};
		var cubeNode = [
			<#if cube??>
			{ id:1, pId:0, name:"${cube.name!''}", open:true}
				<#list cube.dimension as dim>
					,{ id:${1000+dim_index}, pId:1, name:"${dim.name!''}" , open:false}
					<#if dim.cubeLevel??>
						<#list dim.cubeLevel as level>
							,{ id:${(1000+dim_index)*1000+level_index}, pId:${1000+dim_index}, type:"dimensions",lid:"${level.id!''}" , dimid:"${dim.id!''}", name:"${level.name!''}",icon:"/assets/images/dimensions.png"}
						</#list>
					</#if>
					<#if dim.dim?? && dim.dim.cubeLevel??>
						<#list dim.dim.cubeLevel as level>
							,{ id:${(1000+dim_index)*1000+level_index}, pId:${1000+dim_index}, type:"dimensions",lid:"${level.id!''}" , name:"${level.name!''}",icon:"/assets/images/dimensions.png"}
						</#list>
					</#if>
				</#list>
			
				<#if cube.measure?size gt 0>
				,{ id:12, pId:1, name:"指标", open:true}
				<#list cube.measure as measure>
				,{ id:${120000+measure_index}, pId:12, name:"<span style='display:inline-flex;'><input type='checkbox' <#if reportModel ?? && reportModel.measure ?? && reportModel.measure?index_of('${measure.id}') !=-1>checked='checked'</#if> value='${measure.id}' id='${measure.id}' name='measure' onclick='BtnAction.syncReportModelMeasure(this,\"${measure.id}\")' data-check='<#if reportModel ?? && reportModel.measure ?? && reportModel.measure?index_of('${measure.id}') !=-1>true<#else>false</#if>'> <span style='display:inline-flex;'>&nbsp;<i class='tabIcon tci-430' style='height:16px;margin-right:0px;'></i>${measure.name!''}</span></span>" , type:"measure" ,sname:"${measure.name!''}", lid:"${measure.id!''}",icon:""}
				</#list>
				</#if>
			</#if>
		];
	    
		var model =[
			{ id:0, pId:0, name:"组件库", open:true , viewtype:'view'}
			,{ id:100, pId:0, name:'选择组件',open:true , viewtype:'view'}
			,{ id:101, pId:100, name:'下拉列表',iconSkin:"icon02",type:'402881e63b50b068013b5186c72a0001' , viewtype:'view', icon:"/assets/images/icon-file-closed.png"}
			,{ id:102, pId:100, name:'多选框',iconSkin:"icon02",type:'8a875ce43f0ce25d013f0cf78ffc0003' , viewtype:'view', icon:"/assets/images/icon-file-closed.png"}
			,{ id:103, pId:100, name:'下拉树形选择列表',iconSkin:"icon02",type:'8a875ce43f0ce25d013f0cf85b090004' , viewtype:'view', icon:"/assets/images/icon-file-closed.png"}
			,{ id:200, pId:0, name:'输入组件',open:true , viewtype:'view'}
			,{ id:201, pId:200, name:'文本框',iconSkin:"icon02",type:'2cbc808d3b7f6ff8013b7f706f370001' , viewtype:'view', icon:"/assets/images/icon-file-closed.png"}
			,{ id:202, pId:200, name:'日历选择',iconSkin:"icon02",type:'8a875ce43f0ce25d013f0cf943880005' , viewtype:'view', icon:"/assets/images/icon-file-closed.png"}
			,{ id:203, pId:200, name:'日历选择-月',iconSkin:"icon02",type:'8a875ce43f0ce25d013f0cfa401d0006' , viewtype:'view', icon:"/assets/images/icon-file-closed.png"}
			,{ id:300, pId:0, name:'表格组件',open:true , viewtype:'view'}
			,{ id:301, pId:300, name:'普通表格',iconSkin:"icon02",type:'402881e63b50b068013b518865dc0002' , viewtype:'view', icon:"/assets/images/icon-file-closed.png"}
			,{ id:302, pId:300, name:'分页',iconSkin:"icon02",type:'40289e633c70b706013c70e4ad7b0008' , viewtype:'view', icon:"/assets/images/icon-file-closed.png"}
			,{ id:303, pId:300, name:'带边框表格',iconSkin:"icon02",type:'818181073b88d434013b890e01b10004' , viewtype:'view', icon:"/assets/images/icon-file-closed.png"}
			,{ id:2500, pId:0, name:'按钮',open:true , viewtype:'view'}
			,{ id:2501, pId:2500, name:'导出',iconSkin:"icon02",type:'40289e633c70b706013c70ef90360009' , viewtype:'view', icon:"/assets/images/icon-file-closed.png"}
			,{ id:2502, pId:2500, name:'SQL语句版导出',iconSkin:"icon02",type:'8ae3d19b40a4a6170140a4ae70460001' , viewtype:'view', icon:"/assets/images/icon-file-closed.png"}
			,{ id:2503, pId:2500, name:'提交按钮',iconSkin:"icon02",type:'ff8080813b83b45a013b83dc5d4c0012' , viewtype:'view', icon:"/assets/images/icon-file-closed.png"}
			,{ id:2504, pId:2500, name:'取消按钮',iconSkin:"icon02",type:'ff8080813b83b45a013b83dc8c8a0013' , viewtype:'view', icon:"/assets/images/icon-file-closed.png"}
			,{ id:2505, pId:2500, name:'普通按钮',iconSkin:"icon02",type:'ff8080813b83b45a013b83df4be60014' , viewtype:'view', icon:"/assets/images/icon-file-closed.png"}
		];

        var url_list = {
			design_url		: "<#if reportModel??>/${orgi}/design/query/designreport/${report.id!''}/${reportModel.id!''}.html</#if>" ,
			design_rmmeasure_url	: "<#if reportModel??>/${orgi}/design/query/rmmeasure/${report.id!''}/${reportModel.id!''}.html</#if>" ,
			save_url		: "<#if reportModel??>/${orgi}/design/query/${report.id!''}/savereport.html</#if>" ,
			clear_url		: "<#if reportModel??>/${orgi}/design/query/${report.id!''}/${reportModel.id!''}/cleareport.html</#if>",
			del_col_url		: "<#if reportModel??>/${orgi}/design/query/${report.id!''}/${reportModel.id!''}/deletecol.html</#if>",
			merge_url		: "<#if reportModel??>/${orgi}/design/query/merge/${report.id!''}/${reportModel.id!''}.html</#if>",
			clearmerge_url	: "<#if reportModel??>/${orgi}/design/query/rmmerge/${report.id!''}/${reportModel.id!''}.html</#if>",
			cleardim_url	: "<#if reportModel??>/${orgi}/design/query/rmdim/${report.id!''}/${reportModel.id!''}.html</#if>",
			rmnewcol_url	: "<#if reportModel??>/${orgi}/design/query/rmnewcol/${report.id!''}/${reportModel.id!''}.html</#if>",
			rmnewrow_url	: "<#if reportModel??>/${orgi}/design/query/rmnewrow/${report.id!''}/${reportModel.id!''}.html</#if>",
			newcol_url		: "<#if reportModel??>/${orgi}/design/query/addsumcol/${report.id!''}/${reportModel.id!''}.html</#if>",
			newrow_url		: "<#if reportModel??>/${orgi}/design/query/addsumrow/${report.id!''}/${reportModel.id!''}.html</#if>",
			exchange_url	: "<#if reportModel??>/${orgi}/design/query/exchange/${report.id!''}/${reportModel.id!''}.html</#if>",
			exchange_viewtype	: "<#if reportModel??>/${orgi}/design/query/exviewtype/${report.id!''}/${reportModel.id!''}.html</#if>",
			exchange_chartype	: "<#if reportModel??>/${orgi}/design/query/exchartype/${report.id!''}/${reportModel.id!''}.html</#if>",
			style_url	: "<#if reportModel??>/${orgi}/design/query/setstyle/${report.id!''}/${reportModel.id!''}.html</#if>",
			drilldef_url	: "<#if reportModel??>/${orgi}/design/query/drilldef/${report.id!''}/${reportModel.id!''}.html</#if>",
			charts_url	: "<#if reportModel??>/${orgi}/design/query/chart/${report.id!''}/${reportModel.id!''}.html</#if>",
			filteradd_url	: "<#if reportModel??>/${orgi}/design/query/filteradd/${report.id!''}</#if>",
			clearzero_url	: "<#if reportModel??>/${orgi}/design/query/clearzero/${report.id!''}/${reportModel.id!''}.html</#if>",
			filterparam_url	: "<#if reportModel??>/${orgi}/design/query/filterparamadd/${report.id!''}/${reportModel.id!''}.html</#if>",
			warning_url	: "<#if reportModel??>/${orgi}/design/query/warning/${report.id!''}/${reportModel.id!''}.html</#if>",
			editroworcol	: "<#if reportModel??>/${orgi}/design/query/editsumcol/${report.id!''}/${reportModel.id!''}.html</#if>",
			filterquery_url : "/${orgi}/design/query/${report.id!''}/<#if reportModel??>${reportModel.id!''}</#if>/queryFilter.html",
			viewquery_url	: "<#if reportModel??>/${orgi}/design/query/viewQuery/${report.id!''}/${reportModel.id!''}.html</#if>",
			chartvalue_url	: "<#if reportModel??>/${orgi}/design/query/chartvalue/${report.id!''}/${reportModel.id!''}.html</#if>"	,
			addnewpackage	: "<#if reportModel??>/${orgi}/design/query/addnewpackage/${report.id!''}/${reportModel.id!''}.html</#if>",
			deletepackage	: "<#if reportModel??>/${orgi}/design/query/deletepackage/${report.id!''}/${reportModel.id!''}.html</#if>",
			layoutproperties	: "<#if reportModel??>/${orgi}/design/query/layoutproperties/${report.id!''}/${reportModel.id!''}.html</#if>",
			properties			: "<#if reportModel??>/${orgi}/design/query/properties/${report.id!''}/${reportModel.id!''}.html</#if>",
			addlayoutnewrow	: "<#if reportModel??>/${orgi}/design/query/addlayoutnewrow/${report.id!''}/${reportModel.id!''}.html</#if>",
			addlayoutnewcol	: "<#if reportModel??>/${orgi}/design/query/addlayoutnewcol/${report.id!''}/${reportModel.id!''}.html</#if>",
			addnewyaxis	: "<#if reportModel??>/${orgi}/design/query/addnewyaxis/${report.id!''}/${reportModel.id!''}.html</#if>",
			addnewseries	: "<#if reportModel??>/${orgi}/design/query/addnewseries/${report.id!''}/${reportModel.id!''}.html</#if>",
			setxaxisdata	: "<#if reportModel??>/${orgi}/design/query/setxaxisdata/${report.id!''}/${reportModel.id!''}.html</#if>",
			deleteyaxis	: "<#if reportModel??>/${orgi}/design/query/deleteyaxis/${report.id!''}/${reportModel.id!''}.html</#if>",			
			addnewseries	: "<#if reportModel??>/${orgi}/design/query/addnewseries/${report.id!''}/${reportModel.id!''}.html</#if>",
			colrename	: "<#if reportModel??>/${orgi}/design/query/renamecol/${report.id!''}/${reportModel.id!''}.html</#if>",
			hiddencol	: "<#if reportModel??>/${orgi}/design/query/hiddencol/${report.id!''}/${reportModel.id!''}.html</#if>",
			expandrgt	: "<#if reportModel??>/${orgi}/design/query/expandrgt/${report.id!''}/${reportModel.id!''}.html</#if>",
			expandbtm	: "<#if reportModel??>/${orgi}/design/query/expandbtm/${report.id!''}/${reportModel.id!''}.html</#if>",
			analytics_model:"<#if reportModel??>/${orgi}/design/analytics/${report.id!''}/${reportModel.id!''}/reloadmodel.html</#if>" ,
			datagroup_url:"<#if reportModel??>/${orgi}/design/query/datagroup/${report.id!''}/${reportModel.id!''}.html</#if>",
			group_measure_url:"<#if reportModel??>/${orgi}/design/query/loadmeasuregroup/${report.id!''}/${reportModel.id!''}.html</#if>",
			edit_measure_group:"<#if reportModel??>/${orgi}/design/query/measuregroupedit/${report.id!''}/${reportModel.id!''}.html</#if>",
			colpos_url:"<#if reportModel??>/${orgi}/design/query/colpos/${report.id!''}/${reportModel.id!''}.html</#if>",
			savefiltervalues_url:"<#if reportModel??>/${orgi}/design/query/savefiltervalues/${report.id!''}/${reportModel.id!''}.html</#if>",
			countview_url:"<#if reportModel??>/${orgi}/design/query/countview/${report.id!''}/${reportModel.id!''}.html</#if>",
			setColSize:"<#if reportModel??>/${orgi}/design/query/setColSize/${report.id!''}/${reportModel.id!''}.html</#if>",
			micrometer_url:"<#if reportModel??>/${orgi}/design/query/setMicrometer/${report.id!''}/${reportModel.id!''}.html</#if>",
			publish:"<#if reportModel??>/${orgi}/user/publish/${report.id!''}.html</#if>"
		} 
		var rMenu  , cubeNodeZtree ,rMenu_1;
		<#if reportModel??>curModelId = "${reportModel.id!''}" ;</#if>
	    $(document).ready(function(){
			
			KeyEvent.init();
			
			<#if !reportModel?? || (reportModel.viewtype?? && reportModel.viewtype == "view")>
			
			<#else>
			KeyEvent.initChartEvent();
			</#if>
	        cubeNodeZtree = $.fn.zTree.init($(document.getElementById("zTree_adminLIst")), cubeNodeSetting, cubeNode);
	       	rMenu = $("#rMenu");
	       	rMenu_1 = $("#rMenu_1");
        
	        $(".data_model p a").click(function(){
                if(!$(this).hasClass('active')){
                    $(this).siblings().removeClass('active');
                    $(this).addClass('active');
                }
	        });          
			$('.icon_xl span').click(function(event) {
                var curr_ol = $(this).next("ol");

                curr_ol.toggleClass("active");
                $(".selectauto").css({
                    'marginLeft': '-9999px'
                });
                $(document).bind("click", function() { //对document绑定一个隐藏Div方法 
					event.stopPropagation();//点击Button阻止事件冒泡到document
                    curr_ol.removeClass('active');
                });
				event.stopPropagation();//点击Button阻止事件冒泡到document
            });

            $(".icon_xl ol li,.font_div a").click(function(event) {	               
				event.stopPropagation();//点击Button阻止事件冒泡到document 
                //event.stopPropagation();//在Div区域内的点击事件阻止冒泡到document 
            });
			$("#fontcolor").colorpicker({
				fillcolor:true,
	    		target:$("#fontcolor"),
	    		success:function(o,color){
	    			BtnAction.setstyle('color', color , '<#if reportModel??>${reportModel.id}</#if>')
	    		},
				reset:function(){
					BtnAction.setstyle('color', "" , '<#if reportModel??>${reportModel.id}</#if>')
				}
			});
			
			$("#bgcolor").colorpicker({
				fillcolor:true,
	    		target:$("#bgcolor"),
	    		success:function(o,color){
	    			BtnAction.setstyle('backgroundcolor', color , '<#if reportModel??>${reportModel.id}</#if>')
	    		},
				reset:function(){
					BtnAction.setstyle('backgroundcolor', "" , '<#if reportModel??>${reportModel.id}</#if>')
				}
			});
			$('#colorpanel table').css("border","0px");
			$('#DisColor').css("height","10px");
			$('#HexColor').css("height","10px");

			$(".left_btm a").click(function() {
				if (!$(this).hasClass('active')) {
					$(this).siblings().removeClass('active');
					$(this).addClass('active');
					if ($(this).attr('data-node') == "layout") {
						$('#zTree_adminLIst').hide();
						$('#templet').show();
						$('#data').hide();
						$('#comp').show();
						//$.fn.zTree.init($(document.getElementById("zTree_adminLIst")), cubeNodeSetting, model);
					} else {			
						$('#comp').hide();
						$('#data').show();
						$('#templet').hide();
						$('#zTree_adminLIst').show();
						//$.fn.zTree.init($(document.getElementById("zTree_adminLIst")), cubeNodeSetting, cubeNode);
					}
				}
			});
			/**********/
			$(".comp-item").draggable({
				connectToSortable:".design_container",
				helper:"clone"
			});				
	    });
		function submitSearchForm(action){
			//$("#beginNum").val($("#beginNumShow").val());
			//$("#endNum").val($("#endNumShow").val());
			var reg = /^[0-9]*$/;
			if(reg.test($("#p").val())){
				$("#filterlist_form").attr("action",url_list.filterquery_url+"?p="+$("#p").val()+"&ps="+$("#ps").val()+"&opt="+action);
				$("#filterlist_form").submit();
			}else{
				alertMsg("请输入正确的页码信息！");
			}
		}
		
	</script>
	<style type="text/css">
		div#rMenu {position:absolute; visibility:hidden; top:0; background-color: #FFF;text-align: left;z-index:10000;border: 1px solid #09f;border-bottom:0px;}
		div#rMenu ul li{
			margin: 0px 0;
			padding: 5px 5px 5px 5px;				
			cursor: pointer;
			font-size:12px;
			width:100px;
			list-style: none outside none;
			border-bottom: 1px solid #cccccc;
		}
		div#rMenu_1 ul li:hover{
			background-color:#EFEFEF;
		}
		div#rMenu_1 {position:absolute; visibility:hidden; top:0; background-color: #FFF;text-align: left;z-index:10000;border: 1px solid #09f;border-bottom:0px;}
		div#rMenu_1 ul li{
			margin: 0px 0;
			padding: 5px 5px 5px 5px;				
			cursor: pointer;
			font-size:12px;
			width:100px;
			list-style: none outside none;
			border-bottom: 1px solid #cccccc;
		}
		div#rMenu_1 ul li:hover{
			background-color:#EFEFEF;
		}
		
	</style>
</head>
<a href="javascript:void(0)" data-toggle="ajax" data-width="600" class="tbtn" hidden="" id = "drilldef"></a>
<body>
    <div class="container rs_layout" wrapper="true">
        <!-- Everything started here -->
        <div class="rs_layout_top" style="height:98px;">
            <div class="nav_top" style="border-bottom:solid 1px #d8af84;">
                <!--NavTop-->
                <h1 class="comName">
                    ${report.name!''}
                </h1>
                <div class="nav_controlBar">
                    <ul class="nav_controlList">
                        <li class="nav_controlIthems">
                            <i class="navIcons nicon-2">
                            </i>
                            <a href="/${orgi}/user/index.html">首页</a>
                        </li>
                        <!-- <li class="nav_controlIthems" href="/${orgi}/manage/help/showhelp/${mantype!''}/index.html" data-width="800" title="系统帮助" data-toggle="ajax">
                            <i class="navIcons nicon-4">
                            </i>
                            帮助
                        </li> -->
                        <li class="nav_controlIthems">
                        	<a href="javascript:window.close();"><i class="navIcons nicon-5"></i>退出</a>
                        </li>
                    </ul>
                    <h1 class="comName2">
                        R3 Query V5.0 Build 106.56
                    </h1>
                </div>
            </div>
            <div class="function">
				<#if report.creater?? && user?? && user.id?? && report.creater == user.id>
                <span>
                    <a href="javascript:BtnAction.save()" title="保存" class="tbtn" id="save">
                        <img src="/assets/images/top_icon2.png">
                    </a>
                </span>
				</#if>
                <span>
                    <a href="javascript:BtnAction.clear();" title="清空" class="tbtn" id="clear">
                        <img src="/assets/images/ctr-icons-15.png">
                    </a>
                </span>
                <div class="icon_xl b_r_x" title="执行">
                    <a href="/${orgi}/user/report/view/${report.id!''}.html?vt=lazy" target="newexecute">
						<img src="/assets/images/tci-2.png">
					</a>
                	
                	
                    <a  title="转换图表" href="/${orgi}/design/query/chart/${report.id!''}/<#if reportModel??>${reportModel.id!''}</#if>.html" title="转换图表" data-toggle="ajax" data-width="600" class="tbtn">
						<img src="/assets/images/icon-file-1.png">
					</a>
					<a  title="转换表格" href="javascript:javascript:BtnAction.exviewtype()" class="tbtn">
						<img src="/assets/images/icon-file-130.png">
					</a>
					
                </div>
				<span>
                    <a href="javascript:BtnAction.deletecol()" title="删除列" class="tbtn" id="deletecol">
                        <img src="/assets/images/ctr-icons-115.png">
                    </a>
                </span>
				<span>
					<div class="icon_xl m_t_4 b_r_x" title="合并单元格" style="margin-top:0px;">
						<span><img src="/assets/images/top_icon13.png"></span>
						<ol style="width:310px;">
							<li class="title">单元格合并方式</li>
							<li style="padding:10px 0 10px 15px;height:25px;" class="topmenu">
								<div><a href="javascript:BtnAction.mergecell(1)">求和</a></div>
								<div><a href="javascript:BtnAction.mergecell(2)">平均值</a></div>
								<div><a href="javascript:BtnAction.mergecell(5)">平均值（除零）</a></div>
								<div><a href="javascript:BtnAction.mergecell(3)">最大值</a></div>
								<div><a href="javascript:BtnAction.mergecell(4)">最小值</a></div>
							</li>
							<li class="title">合并单元格数据格式：
								<select id="mergeformat" name="mergeformat" style="width:155px;">
									<option value="###">###</option>
									<option value="###,###">###,###</option>
									<option value="###,###.##">###,###.##</option>
									<option value="###.###">###.###</option>
									<option value="###,###.###">###,###.###</option>
									<option value="###.####">###.####</option>
								</select>
							</li>
						</ol>
					</div>
					<a href="javascript:BtnAction.clearmerge()" title="取消合并单元格" class="tbtn"  title="拆分单元格">
						<img src="/assets/images/top_icon12.png">
					</a>
					<a href="javascript:BtnAction.clearzero()" title="除零">
						<img src="/assets/images/clearzero.png">
					</a>
                </span>
				<span>
                    <a href="/${orgi}/design/query/addsumcol/${report.id!''}/<#if reportModel??>${reportModel.id!''}</#if>.html" data-toggle="ajax" data-lock="false" data-width="600" title="新增列" class="tbtn" id="deletecol">
                        <img src="/assets/images/ctr-icons-119.png">
                    </a>
					<a href="/${orgi}/design/query/addsumrow/${report.id!''}/<#if reportModel??>${reportModel.id!''}</#if>.html" data-toggle="ajax" data-width="600" title="新增行" class="tbtn" id="deletecol">
                        <img src="/assets/images/ctr-icons-120.png">
                    </a>
					<a href="javascript:BtnAction.exchange()" title="交换行列">
						<img src="/assets/images/top_icon121.png">
					</a>
					
					<a href="javascript:BtnAction.warning()" title="数据预警">
						<img src="/assets/images/top_icon122.png">
					</a>
					
					<a href="javascript:BtnAction.editNewRowCol()" title="修改汇总行/列">
						<img src="/assets/images/top_icon125.png">
					</a>
					
					<a href="javascript:BtnAction.setColRename()" title="重命名">
                        <img src="/assets/images/bookmark-toolbar-4.png">
                    </a>
                    <a href="javascript:BtnAction.setHiddencol()" title="隐藏指定列">
                        <img src="/assets/images/arrow-in.png">
                    </a>
					<a href="javascript:void(0)" data-toggle="ajax" data-befor="BtnAction.drilldef(this);" data-width="650" class="tbtn" title="向上/向下钻取">
						<img src="/assets/images/top_icon123.png">
					</a>
                </span>
            </div>
            <div class="font_div">
                <div class="f_slc" style="width:110px;">
                    <input name="" class="text" type="hidden" value="Font">
                    <div class="shtitle lx1">
                        <em title="字体">
                            <#if reportModel?? && reportModel.style?? && reportModel.style.font_family??>${reportModel.style.font_family}<#else>字体</#if>
                        </em>
                        <ul class="selectauto" id="s1">
                            <li svalue="01" onclick="javascript:BtnAction.setstyle('font_family','Arial' , '<#if reportModel??>${reportModel.id}</#if>')">
                                Arial
                            </li>
							<li svalue="01" onclick="javascript:BtnAction.setstyle('font_family','Helvetica' , '<#if reportModel??>${reportModel.id}</#if>')">
                                Helvetica
                            </li>
							<li svalue="01" onclick="javascript:BtnAction.setstyle('font_family','sans-serif' , '<#if reportModel??>${reportModel.id}</#if>')">
                                sans-serif
                            </li>
							<li svalue="01" onclick="javascript:BtnAction.setstyle('font_family','SimSun' , '<#if reportModel??>${reportModel.id}</#if>')">
                                SimSun
                            </li>
							<li svalue="01" onclick="javascript:BtnAction.setstyle('font_family','微软雅黑' , '<#if reportModel??>${reportModel.id}</#if>')">
                                微软雅黑
                            </li>
							<li svalue="01" onclick="javascript:BtnAction.setstyle('font_family','宋体' , '<#if reportModel??>${reportModel.id}</#if>')">
                                宋体
                            </li>
							<li svalue="01" onclick="javascript:BtnAction.setstyle('font_family','黑体' , '<#if reportModel??>${reportModel.id}</#if>')">
                                黑体
                            </li>
                        </ul>
                    </div>
                </div>
                <div>
                    <span style="padding-top:3px;">
						<div class="icon_xl m_t_4" id="fontcolor" title="字体颜色设置" style="margin-top:1px;">
							<i>
								<img src="/assets/images/top_icon16.png">
							</i>
						</div>
						<a href="javascript:BtnAction.setstyle('font_weight','bold' , '<#if reportModel??>${reportModel.id}</#if>')">
							<img src="/assets/images/top_icon17.png">
						</a>
						<a href="javascript:BtnAction.setstyle('font_style','italic' , '<#if reportModel??>${reportModel.id}</#if>')">
							<img src="/assets/images/top_icon18.png">
						</a>
						<span>
							<a href="javascript:BtnAction.setstyle('text_decoration','underline' , '<#if reportModel??>${reportModel.id}</#if>')">
								<img src="/assets/images/top_icon19.png">
							</a>
						</span>
						<a href="javascript:BtnAction.setstyle('margin','left' , '<#if reportModel??>${reportModel.id}</#if>')">
							<img src="/assets/images/top_icon20.png">
						</a>
						<a href="javascript:BtnAction.setstyle('margin','center' , '<#if reportModel??>${reportModel.id}</#if>')">
							<img src="/assets/images/top_icon21.png">
						</a>
						<a href="javascript:BtnAction.setstyle('margin','right' , '<#if reportModel??>${reportModel.id}</#if>')">
							<img src="/assets/images/top_icon23.png">
						</a>
					</span>
                </div>
                <div class="f_slc" style="width:80px;">
                    <input name="" class="text" type="hidden" value="Size">
                    <div class="shtitle lx2">
                        <em title="字体大小">
                            <#if reportModel?? && reportModel.style?? && reportModel.style.font_size??>${reportModel.style.font_size}<#else>Size</#if>
                        </em>
                        <ul class="selectauto" id="s2">
                            <li svalue="01" onclick="javascript:BtnAction.setstyle('font_size','12px' , '<#if reportModel??>${reportModel.id}</#if>')">
                                12px
                            </li>
                            <li svalue="02" onclick="javascript:BtnAction.setstyle('font_size','14px' , '<#if reportModel??>${reportModel.id}</#if>')">
                                14px
                            </li>
                            <li svalue="03" onclick="javascript:BtnAction.setstyle('font_size','16px' , '<#if reportModel??>${reportModel.id}</#if>')">
                                16px
                            </li>
                            <li svalue="04" onclick="javascript:BtnAction.setstyle('font_size','18px' , '<#if reportModel??>${reportModel.id}</#if>')">
                                18px
                            </li>
							<li svalue="04" onclick="javascript:BtnAction.setstyle('font_size','20px' , '<#if reportModel??>${reportModel.id}</#if>')">
                                20px
                            </li>
							<li svalue="04" onclick="javascript:BtnAction.setstyle('font_size','22px' , '<#if reportModel??>${reportModel.id}</#if>')">
                                22px
                            </li>
                        </ul>
                    </div>
                </div>
                <div class="icon_xl m_t_4" id="bgcolor" title="背景颜色设置">
                    <i>
                        <img src="/assets/images/color-swatch.png">
                    </i>
                </div>	
                <a href="javascript:BtnAction.setMicrometer();" title="千分位">
                    <img src="/assets/images/tag-purple.png">
                </a>			
				<div class="icon_xl m_t_4" id="parityline">
                   <div class="navmsgNum2" style="float:none;border-right:0px;line-height:15px;margin-top:1px;margin-right:0px;height:15px;cursor: pointer;" title="所有行" onclick="BtnAction.setParityline(this)">%</div>
                </div> 
                
                

				<div class="icon_xl m_t_4 b_r_x">
					<a href="javascript:BtnAction.clearStyle('<#if reportModel??>${reportModel.id}</#if>');" title="清除已设置的所有格式">
						<img src="/assets/images/eraser.png">
					</a>
                </div>
                <div class="f_slc" style="width:80px;">
                    <input name="" class="text" type="hidden" value="colSize">
                    <div class="shtitle lx3">
                        <em title="显示列数">
                            <#if reportModel?? && reportModel.colSize != 0 >${reportModel.colSize!''}<#else>100</#if>
                        </em>
                        <ul class="selectauto" id="s3">
                            <li svalue="01" onclick="javascript:BtnAction.setColSize('50')">
                                50
                            </li>
                            <li svalue="01" onclick="javascript:BtnAction.setColSize('100')">
                                100
                            </li>
                            <li svalue="01" onclick="javascript:BtnAction.setColSize('150')">
                                150
                            </li>
                            <li svalue="01" onclick="javascript:BtnAction.setColSize('200')">
                                200
                            </li>
							<li svalue="01" onclick="javascript:BtnAction.setColSize('300')">
                                300
                            </li>
							<li svalue="01" onclick="javascript:BtnAction.setColSize('500')">
                                500
                            </li>
                        </ul>
                    </div>
                </div>
				<span>
                    <a href="<#if reportModel??>/${orgi}/design/query/exportdata/${report.id!''}/${reportModel.id!''}.html?wt=excel&opt=0<#if reportModel?? && reportModel.reportData?? && reportModel.reportData.queryText??>&keyid=${reportModel.reportData.queryText.key!''}&total=${reportModel.reportData.total!''}</#if></#if>" target="_blank" title="导出到Excel">
						<img src="/assets/images/excel.png">
					</a>
					<a href="<#if reportModel??>/${orgi}/design/query/exportdata/${report.id!''}/${reportModel.id!''}.html?wt=csv&opt=0<#if reportModel?? && reportModel.reportData?? && reportModel.reportData.queryText??>&keyid=${reportModel.reportData.queryText.key!''}&total=${reportModel.reportData.total!''}</#if></#if>" target="_blank" title="导出到CSV">
						<img src="/assets/images/csv_text.png">
					</a>
					<a href="<#if reportModel??>/${orgi}/design/query/exportdata/${report.id!''}/${reportModel.id!''}.html?wt=xml&opt=0<#if reportModel?? && reportModel.reportData?? && reportModel.reportData.queryText??>&keyid=${reportModel.reportData.queryText.key!''}&total=${reportModel.reportData.total!''}</#if></#if>" target="_blank" title="导出到XML">
						<img src="/assets/images/xml.png">
					</a>
					<a href="<#if reportModel??>/${orgi}/design/query/exportdata/${report.id!''}/${reportModel.id!''}.html?wt=pdf&opt=0<#if reportModel?? && reportModel.reportData?? && reportModel.reportData.queryText??>&keyid=${reportModel.reportData.queryText.key!''}&total=${reportModel.reportData.total!''}</#if></#if>" target="_blank" title="导出到PDF">
						<img src="/assets/images/pdf.png">
					</a>
					<a href="javascript:BtnAction.viewQuery()" title="查询语句设定" class="tbtn" id="viewQuery">
						<img src="/assets/images/sql.png">
					</a>
					<a href="javascript:BtnAction.countView()" title="数据概览" class="tbtn" id="countView">
						<img src="/assets/images/accessories-calculator-4.png">
					</a>
               </span>
				<!--
                <div class="icon_xl m_t_4 b_r_x">
                    <span>
                        <img src="/assets/images/top_icon25.png">
                    </span>
                </div>
                <div class="icon_xl m_t_4">
                    <i>
                        <img src="/assets/images/top_icon26.png">
                    </i>
                </div>
                <div class="icon_xl m_t_4">
                    <i>
                        <img src="/assets/images/top_icon27.png">
                    </i>
                </div>
                <div class="icon_xl m_t_4">
                    <i>
                        <img src="/assets/images/top_icon28.png">
                    </i>
                </div>
                <div class="icon_xl m_t_4">
                    <i>
                        <img src="/assets/images/top_icon29.png">
                    </i>
                </div>
				-->
            </div>
        </div>
        <div class="rs_layout_left" resizable="true" minsize="true" style="width:230px;">
			<div class="rs_layout">
				<div class="rs_layout_top">
					<div class="data_model" style="height:27px;">                                
						<p id="data">
							<!--
							<a href="javascript:void(0)">
								<img src="/assets/images/left_icon1.png">
							</a>
							<a href="javascript:void(0)">
								<img src="/assets/images/left_icon2.png">
							</a>
							<a href="javascript:void(0)">
								<img src="/assets/images/icon-file-2.png">
							</a>
							<a href="javascript:void(0)">
								<img src="/assets/images/left_icon3.png">
							</a>

							-->
							<a href="/${orgi}/design/query/selcube/${report.id!''}.html<#if reportModel??>?modelid=${reportModel.id!''}</#if>" data-toggle="ajax"  title="修改数据模型" style="font-size:14px;">
								<img src="/assets/images/left_icon4.png">
							</a> 

							<a href="<#if reportModel??>/${orgi}/design/query/${report.id!''}/updatecache.html?modelid=${reportModel.id!''}</#if>" data-toggle="load" title="清空数据缓存" data-target="#design_table">
								<img src="/assets/images/left_icon5.png">
							</a>
						</p>
						<p id="comp" style="display:none;line-height:25px;text-align:center;background-color: #09f;color:#FFF;">
							系统可用组件列表
						</p>
					</div>
				</div>
				<div class="rs_layout_center">
					<div class="lftTreeWrap lf_ct">
						<div class="ztree" id="zTree_adminLIst"></div>
						<div id="templet" style="display:none;">
							<div class="comp-temp">
								<#if catagoryList??>
									<#list catagoryList as category>
										<div class="tc_panel">
											<div class="tc_title">${category.name!''}</div>
										</div>
										<#if templetList??>
										<#list templetList as templet>
											<#if templet.typeid?? && templet.typeid == category.id>
											<div class="comp-item" data-templet="${templet.id!''}">
												<img src="${templet.iconstr!''}">
												<p>${templet.name!''}</p>
											</div>
											</#if>
										</#list>
										</#if>
									</#list>
								</#if>
								<#if chartCategoryList??>
									<#list chartCategoryList as category>
										<div class="tc_panel">
											<div class="tc_title">${category.name!''}</div>
										</div>
										<#if templetList??>
										<#list templetList as templet>
											<#if templet.typeid?? && templet.typeid == category.id>
											<div class="comp-item" data-templet="${templet.id!''}" style="text-align:center;">
												<img src="${templet.iconstr!''}">
												<p style="width:50px;overflow:hidden;white-space:nowrap;text-align:center;padding:5px;">${templet.name!''}</p>
											</div>
											</#if>
										</#list>
										</#if>
									</#list>
								</#if>
								<!--
								<div class="comp-item">
									<img src="/assets/images/design/table.png">
									<p>表格</p>
								</div>
								<div class="comp-item">
									<img src="/assets/images/design/pie_chart_blue.png">
									<p>饼图</p>
								</div>
								<div class="comp-item">
									<img src="/assets/images/design/map.png">
									<p>地图</p>
								</div>
								<div class="comp-item">
									<img src="/assets/images/templeticon/type_micro_line.gif">
									<p>折线图</p>
								</div>
								-->
							</div>
						</div>
					</div>
				</div>
				<#if !reportModel?? || (reportModel.viewtype?? && reportModel.viewtype == "view")>
	
				<#else>
					<div class="rs_layout_bottom left_btm">								
						<a href="#" data-id="2" class="active" data-node="model">
							<img src="/assets/images/left_icon7.png">
							模型
						</a>
						<a href="#" data-id="1" data-node="layout">
							<img src="/assets/images/left_icon6.png">
							组件
						</a>
					</div>	
				</#if>                         
			</div>
		</div>
		<!--<div class="rs_layout_right" style="width:300px;"></div>-->
		<div class="rs_layout_center" id="rootlayout">
			<div id="design_table" class="rs_layout">
				<#include "datadiv.html"/> 							
			</div>
		</div>
    </div>
	<div id="rMenu">
		<ul>
			<li id="m_add" onclick="tableOperator('filter');"><span><img src="/assets/images/top_icon124.png"/></span><span style="margin-left:10px;">添加过滤器</span></li>
			<li id="m_del" onclick="tableOperator('col');"><span><img src="/assets/images/ctr-icons-119.png"></span><span style="margin-left:10px;">添加到列</span></li>
			<li id="m_check" onclick="tableOperator('row');"><span><img src="/assets/images/ctr-icons-120.png"></span><span style="margin-left:10px;">添加到行</span></li>
			<li id="m_unCheck" onclick="tableOperator('drill');"><span><img src="/assets/images/top_icon123.png"></span><span style="margin-left:10px;">插入钻取</span></li>
			<li id="m_reset" onclick="tableOperator('remove');" style="border-bottom:1px solid #09f;"><span><img src="/assets/images/ctr-icons-115.png"></span><span style="margin-left:10px;">从表格中移除</span></li>
		</ul>
	</div>
	<div id="rMenu_1">
		<ul>
			<!--<li id="m_add" onclick="tableOperator('filter');"><span><img src="/assets/images/top_icon124.png"/></span><span style="margin-left:10px;">添加过滤器</span></li>-->
			
			<li id="m_del" style="width: 150px;">
				<span>
					<a style="display: none;" data-toggle="ajax" href="/rivues/user/report/pub/reportproperties/4028d88f47d2de6b0147d32dc495084a/ff808081488cae5701488d1aaca1090a.html" title="设置属性"><i class="tbControlIcon tci-8"></i></a>
					<img src="/assets/images/ctr-icons-119.png">
					</span><span style="margin-left:10px;">
					<a href="javascript:tableOperator('group');">添加到组</a>
				</span>
				<div id="rMenu_group" style="width: 150px;">
					<#include "loadmeasuregroup.html"/>
				</div>
			</li>
			
			<li style="width: 150px;" id="m_group" onclick="tableOperator('col');"><span><img src="/assets/images/ctr-icons-119.png"></span><span style="margin-left:10px;">添加到列</span></li>
			<li style="width: 150px;" id="m_unCheck" onclick="tableOperator('drill');"><span><img src="/assets/images/top_icon123.png"></span><span style="margin-left:10px;">插入钻取</span></li>
			<li style="width: 150px;" id="m_reset" onclick="tableOperator('remove');" style="border-bottom:1px solid #09f;"><span><img src="/assets/images/ctr-icons-115.png"></span><span style="margin-left:10px;">从表格中移除</span></li>
		</ul>
	</div>

<!--[if gte IE 8]>
<script type="text/javascript">
	$(".shtitle").each(function(i) {
		var ls = $('.lx'+(i+1)+' li').width();
		$('.lx'+(i+1)+' em').css({'width': ls + 'px'});
	});
</script>
 <![endif]-->
 <!--[if !IE]><!--> 
<script type="text/javascript">
	$(function() {
		$(".shtitle").each(function(i) {
			var ls = $('.lx' + (i + 1) + ' li').width();
			$('.lx' + (i + 1) + ' em').css({
				'width': ls + 'px'
			});
			$(this).css("z-index","1000");
		});
	});
</script>
 <!--<![endif]-->
</body>
</html>